from distributed_agent.flow_orchestration import NacosServiceDiscovery
from typing import Dict, Optional, List


class PlannerAgent:
    def __init__(self, nacos: NacosServiceDiscovery):
        self.nacos = nacos

    async def decide_next_agents(self, state: FlowState) -> List[str]:
        """根据用户查询和当前状态决定调用哪些Agent"""
        user_query = state.user_query
        agents = []
        # 规则1：含"生成图片"等关键词时调用多模态Agent
        if "图片" in user_query or "生成" in user_query:
            agents.append("multimodal_agent_service")
        # 规则2：含"热度"、"评分"等关键词时调用舆情Agent
        if "热度" in user_query or "评分" in user_query:
            agents.append("popularity_agent_service")
        # 原有RAG和MCP调用逻辑
        agents.extend(["rag_agent_service", "mcp_agent_service"])
        return agents